<template>
    <div class="img">
        <el-row class="rowCl">
            <el-col :span="8">
                <div class="grid-content bg-purple"> &nbsp;</div>
            </el-col>
            <el-col :span="8">
                <div class="grid-content bg-purple-light">
<!--                    <el-card class="box-card">-->
                        <h3 style="text-align: center">登录</h3>
                        <el-form>
                            <el-row>
                                <el-col :span="24">
                                    <div class="grid-content bg-purple-dark">
                                        <el-form-item label="用户名：" prop="userName">
                                            <el-input v-model="userName"></el-input>
                                        </el-form-item>
                                        <span>超管账号  java</span>
                                    </div>
                                </el-col>
                            </el-row>
                            <el-row style="margin-top: 10px">
                                <el-col :span="24">
                                    <div class="grid-content bg-purple-dark">
                                        <el-form-item label="用户密码：" prop="password">
                                            <el-input v-model="password" show-password></el-input>
                                        </el-form-item>
                                        <span>超管密码  1234</span>
                                    </div>
                                </el-col>
                            </el-row>

                        </el-form>
                        <el-button type="primary" style="margin-top: 10px;margin-right: 10px"
                                   @click="login()">登录
                        </el-button>
<!--                    </el-card>-->
                </div>
            </el-col>
            <el-col :span="8">
                <div class="grid-content bg-purple">&nbsp;</div>
            </el-col>
        </el-row>
    </div>
</template>

<script>

    export default {
        name: "LoginCom",
        data(){
            return{
                userName:'',
                password:'',
                name:'',
            }
        },

        methods:{
            login(){
                console.log(this.userName + this.password)
                if (this.userName == '' || this.userName == undefined
                    || this.password == '' || this.password == undefined){
                        this.$message({
                            type: 'info',
                            message: '账号或密码错误'
                        });
                }else {
                    //登录            sscsys/apc
                    this.$axios.get("/sscsys/user/login/"
                        + this.userName + "/" + this.password + "/0").then(
                        r => {
                            console.log(r.data)
                            if (r.data.name != null || r.data.name != undefined) {
                                // let token=  r.data;
                                this.$store.state.userName = this.userName
                                this.$router.push("IndexView")
                            } else {
                                this.$message({
                                    type: 'info',
                                    message: '账号或密码错误'
                                });
                            }

                        }

                    )}

            },
        }
    }
</script>

<style scoped>
 .img{
     width: 1250px;
     height: 500px;
     background-image: url("login.jpg");
 }
</style>